UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EaKGh++O5sckQKhGS6rhSciaUCFKaLmLH54YYcey2mM=' 
WHERE 
  key_id = '2aa6461e1f2c2a5f67de7d71d2a95198beabcde1d9deb7eee94fdb9b0e8e01eb' 
  AND (
    token = 'EaKGh++O5sckQKhGS6rhSciaUCFKaLmLH54YYcey2mM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046