UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'odDwjxE/1NsbVBvdkiqbAqb5hxXZqlKxBfCTzx1wgYY=' 
WHERE 
  key_id = '76f8c7ccaea578fcc4263bf76f26c08d7e6432c47d99022003c07694088d02bc' 
  AND (
    token = 'odDwjxE/1NsbVBvdkiqbAqb5hxXZqlKxBfCTzx1wgYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035