UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rb4CKv8rBqg3s+ym99kwQ7BavkfZqB0xsR6Z/hxjqug=' 
WHERE 
  key_id = '371fc9ae06add8338d0f92eb9c8857733586f662850a08a32d46a27e7b4e6bb2' 
  AND (
    token = 'rb4CKv8rBqg3s+ym99kwQ7BavkfZqB0xsR6Z/hxjqug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030