UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K6AlAmLn1O2e62fL5a0nZ9xJcMQxo+RS2q6y+P9w94I=' 
WHERE 
  key_id = '456d7355428a1264ddf942b54250ba5ee98d1981eaeba1b9bfce99628a208943' 
  AND (
    token = 'K6AlAmLn1O2e62fL5a0nZ9xJcMQxo+RS2q6y+P9w94I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038