UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0X83qQxA14uDuVX/H6wdFz+ax45c40IkS5QLdSNBuQE=' 
WHERE 
  key_id = '32d7feb1d87880fcabb047e1ffa45f51e4d7f927a65010c7f4355667f805cc39' 
  AND (
    token = '0X83qQxA14uDuVX/H6wdFz+ax45c40IkS5QLdSNBuQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034