UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sM6XtNibWpgV9kwRuXxYueZk29rH6j/ZwE+Kqzl7Dw8=' 
WHERE 
  key_id = '45f82da35ef0752cb605c6c7e3f06c35409152695b6090c0f06dcabdb3243211' 
  AND (
    token = 'sM6XtNibWpgV9kwRuXxYueZk29rH6j/ZwE+Kqzl7Dw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032