UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ekopwVELxQ0Da/UPHwDc9Q0SFuBICt8yeXH6xiq8Hvo=' 
WHERE 
  key_id = '38dc432bd8d3e1099f794ee43e8e3412d34fd22e076719395e163c719c837e37' 
  AND (
    token = 'ekopwVELxQ0Da/UPHwDc9Q0SFuBICt8yeXH6xiq8Hvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029