UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KMoZwQplFCwdZNn8koHvmtdZDpvcJba8xB1NCxYG9Bk=' 
WHERE 
  key_id = '05c4e20c508581c52c8bf43253b994514638da13464c11aa64d07a33b272c7df' 
  AND (
    token = 'KMoZwQplFCwdZNn8koHvmtdZDpvcJba8xB1NCxYG9Bk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040