UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YKWbtPwGiRcrlIuxmfnzVRl+lYkxIr3tGY6MD41KpEc=' 
WHERE 
  key_id = 'ebab8bd476968c4dd4c946d0b8721f677bf7b766b27d14d90a8350dec61de6ee' 
  AND (
    token = 'YKWbtPwGiRcrlIuxmfnzVRl+lYkxIr3tGY6MD41KpEc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030