UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1UWH16Jk4OtyK+I3KtjYnmh2XpUNeRTLozpy787XMOw=' 
WHERE 
  key_id = 'c42715e9ade012428d1590583f076addf17696b3b66a26e93f4b285bb7fea153' 
  AND (
    token = '1UWH16Jk4OtyK+I3KtjYnmh2XpUNeRTLozpy787XMOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052