UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zzNuKBiEKj2wXd4Jo2IoLDueDHOdeMhymQAYH6eCHZ4=' 
WHERE 
  key_id = 'cd4fc98b7adc97674d298a5bb679147fce81071757de960362597c5b430c67ca' 
  AND (
    token = 'zzNuKBiEKj2wXd4Jo2IoLDueDHOdeMhymQAYH6eCHZ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032