UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7QreHvKRs59YDjV34c3/crOby3IZIbhVFsiu2DDAR80=' 
WHERE 
  key_id = 'ebc5c1831ae1402d1d24986d8baa1540773936736b63976332e307c462bce00e' 
  AND (
    token = '7QreHvKRs59YDjV34c3/crOby3IZIbhVFsiu2DDAR80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032