UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VtBQ9t5vjlZklYvxjvqqmhudFBz76MXhRA54n7NIM9I=' 
WHERE 
  key_id = '881cb05b4339ad976c473f73012ca8e3d6acf24d906666e6e3770c29f956a589' 
  AND (
    token = 'VtBQ9t5vjlZklYvxjvqqmhudFBz76MXhRA54n7NIM9I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037