UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kbW1EAGKgOkBssPZrblpVngMzqBTXc/HlxqbUGuiSdw=' 
WHERE 
  key_id = 'a16d2a66c24066d3ef20e58090e376a9d46132082cd454084bf0537cb50ca996' 
  AND (
    token = 'kbW1EAGKgOkBssPZrblpVngMzqBTXc/HlxqbUGuiSdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023