UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QvnlIKU7yzTX0uesgKsev5wz3mDLWGbtUaER9GCySAc=' 
WHERE 
  key_id = '10cd2e7a6cdd27a33f240ff10c26442b8568fef4dba467b598e4eaa102cc4879' 
  AND (
    token = 'QvnlIKU7yzTX0uesgKsev5wz3mDLWGbtUaER9GCySAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025