UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bXXyh9C3mgWWi9tnzkhZV2kfSnMZHu+Rg2ES6bY4zxI=' 
WHERE 
  key_id = '5db32f6b158dc4e4fe70744ede9dc18107535c0c25f1311590106cbbaab1613f' 
  AND (
    token = 'bXXyh9C3mgWWi9tnzkhZV2kfSnMZHu+Rg2ES6bY4zxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034