UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aViGInZEBiYvNp0Tn+IISItl2yU9biDWSkHNNwiijoE=' 
WHERE 
  key_id = '74456c08b25b7408a676722b33da18a233d9cd4c4de5aecdc1d2d4f95d8d6176' 
  AND (
    token = 'aViGInZEBiYvNp0Tn+IISItl2yU9biDWSkHNNwiijoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034