UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cMYp43mmNCWnbxH0kVXGhBNzD7Bv9ehjWkLvWez6MIs=' 
WHERE 
  key_id = '17ab4c3d94da2f9fc544f363f020bd1534aacde4ddb765dfcfa5db1db63d0e30' 
  AND (
    token = 'cMYp43mmNCWnbxH0kVXGhBNzD7Bv9ehjWkLvWez6MIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017