UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L30ptLuHvKkBYzP2aY/0b9C3H/csQv7zZ/JdaFCohAw=' 
WHERE 
  key_id = '6214d617b66cd6a027db4689fc3f234ce8d627ad224604fb9d2e977296deeb86' 
  AND (
    token = 'L30ptLuHvKkBYzP2aY/0b9C3H/csQv7zZ/JdaFCohAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036