UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yiJT8CwC7KA69H3nhM8rM4WKKDQvMGcuDQr7LQAokrw=' 
WHERE 
  key_id = '4048aaa6b874335bb0b0255751073d554d44dbacc507b461462c3b8ee6c875b7' 
  AND (
    token = 'yiJT8CwC7KA69H3nhM8rM4WKKDQvMGcuDQr7LQAokrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040