UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ts9gUt4egaO8btlU2IH5viTNxtf63uKn4y6my0bt4oU=' 
WHERE 
  key_id = 'aa84639da7dd9c274931e3668117bf3b2b84a4b172f2178c538b7841a80fe5c0' 
  AND (
    token = 'Ts9gUt4egaO8btlU2IH5viTNxtf63uKn4y6my0bt4oU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031