UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PcbvOS1U5l9JMB8Cek+kDqYFoIuooNvyPAAzeFL9osE=' 
WHERE 
  key_id = '246775160c485267ad24a9f7e426ae15a2eee0865f4061f40ad09b830941478e' 
  AND (
    token = 'PcbvOS1U5l9JMB8Cek+kDqYFoIuooNvyPAAzeFL9osE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032