UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aJcuLOzTR503GMqHlXmRqF8W4Z/zTTqE/KP1tWDZDPg=' 
WHERE 
  key_id = '51c8fc68de2289bdcb71eee0135ed1d965ac05ff1149f265f66c2d98f7370630' 
  AND (
    token = 'aJcuLOzTR503GMqHlXmRqF8W4Z/zTTqE/KP1tWDZDPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026