UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9I5BtWtQpjldmK9iSeYUBlmKXueeUkUV1gK96SCat0U=' 
WHERE 
  key_id = 'fab1d55d592ce1ec3e7e010f4e62237fc6864a5b96c90ca9664e226575a1058f' 
  AND (
    token = '9I5BtWtQpjldmK9iSeYUBlmKXueeUkUV1gK96SCat0U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034