UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UG86Ky46qWnplzGgzjwZMI99TTmUaAB/QWKAKWZMvOw=' 
WHERE 
  key_id = '17b38de32042017d8a745396a0b3f82d87ea514986e54bf57b43703ba9e9dc86' 
  AND (
    token = 'UG86Ky46qWnplzGgzjwZMI99TTmUaAB/QWKAKWZMvOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036