UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ns+2Xu240X4BEzHmqmlthsTKAQwTBoPA39B5gs6mEw8=' 
WHERE 
  key_id = '094c694402061271287f2454c61034204bc1a2f78c6ac3fc7f51c83fa288f4a3' 
  AND (
    token = 'ns+2Xu240X4BEzHmqmlthsTKAQwTBoPA39B5gs6mEw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034