UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jG5Ahzp5s5udzNdVQyFNplJT5xZyTowrT7ZgLcDYtZ8=' 
WHERE 
  key_id = '2452d4c708547266bc19d26e1f1865520b03aa00db5387641c7dbb10636dc097' 
  AND (
    token = 'jG5Ahzp5s5udzNdVQyFNplJT5xZyTowrT7ZgLcDYtZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053