UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p51q6ClSC3hMz/Amsq63+u/vgji72qITb3Js9i765b0=' 
WHERE 
  key_id = '571bf4dfd1be6b514de9eb727110a1fbcb12da62c3f494c14eb7a4c6ba938ba3' 
  AND (
    token = 'p51q6ClSC3hMz/Amsq63+u/vgji72qITb3Js9i765b0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035