UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gjHj4EMupQi5uOp4Il0Fpk+re+78KUZn2mEcSuxtNd4=' 
WHERE 
  key_id = 'e8d7274ea84dda178fcab91d03f2a1e910f0e810f4d258a0d9da3b0053d6b10e' 
  AND (
    token = 'gjHj4EMupQi5uOp4Il0Fpk+re+78KUZn2mEcSuxtNd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051