UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'psAn6FALJKWl/1uSZkX1ahVvD/SrbWhf7iO+n9bn4So=' 
WHERE 
  key_id = '32a7babcdf00a9b6dfa747832af223e7c256529ca074b182a0db94c80904f933' 
  AND (
    token = 'psAn6FALJKWl/1uSZkX1ahVvD/SrbWhf7iO+n9bn4So=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046