UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4DobZZTcwofYE0C61aUEfM6TIhamZfz1lasa7YOLvAQ=' 
WHERE 
  key_id = 'b1af754b9d57a6e78603ee70d6b971cc404db7747b9ab24585957762db053e81' 
  AND (
    token = '4DobZZTcwofYE0C61aUEfM6TIhamZfz1lasa7YOLvAQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022