UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9s0Sh/7V7nJRiECN++aMWLniEI8r6EdANNOwVhZr0tw=' 
WHERE 
  key_id = 'b57771365af40cfa03801df45185dbd59956d7dd1e2a106010c7d3c3871f01f5' 
  AND (
    token = '9s0Sh/7V7nJRiECN++aMWLniEI8r6EdANNOwVhZr0tw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037