UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eS9XU1XyNJej56uPo4l4bOz5+uBInPY/QPX7OHMCbGI=' 
WHERE 
  key_id = 'c642db25214491a511d6be6b034e0c39d3b7c526f176c133da742dd1c5648de5' 
  AND (
    token = 'eS9XU1XyNJej56uPo4l4bOz5+uBInPY/QPX7OHMCbGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026