UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kavTj8nz6yxHR+QGWWVEcLmzuXP482E6b9sRyXPttmg=' 
WHERE 
  key_id = '0456289f680ec1e5bb2a5214cc9877c7ff5432652dcc0dff25edd1e0d982391e' 
  AND (
    token = 'kavTj8nz6yxHR+QGWWVEcLmzuXP482E6b9sRyXPttmg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056