UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P3xhLtQ6xzO8uhYMr+mXic92gzLVkX+uZDQd9KRxFqM=' 
WHERE 
  key_id = '3dcca4f805e26de2a4066257ef302a66ed4a2f59877048ff849be4041e0f7cee' 
  AND (
    token = 'P3xhLtQ6xzO8uhYMr+mXic92gzLVkX+uZDQd9KRxFqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034