UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UqAirZ6bP2gejrf3oDSf713ggfomq55vvDxoDdllBTk=' 
WHERE 
  key_id = '67a652f1fb512e4d1f461f85a55e3f6258a8f096193d7cd5db47c8e03fad8242' 
  AND (
    token = 'UqAirZ6bP2gejrf3oDSf713ggfomq55vvDxoDdllBTk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032