UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vrA0cDA9TqG4FC+cfoKNC6Vl7XctyheBnlvzc1UUd+Q=' 
WHERE 
  key_id = 'd4bd4cee584abe00f391b7d7f5365c4324fe9ca5ed2542d44b4f2b23f0db1881' 
  AND (
    token = 'vrA0cDA9TqG4FC+cfoKNC6Vl7XctyheBnlvzc1UUd+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038