UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ol+IJbfD5mNGSXE5whMJn1nQq2r5Y8q6JeIeEp8MlXw=' 
WHERE 
  key_id = '5fb207ebaeb86fed41ac42d985e2e7d3243f6495201b4f46cd7f0791fa675e9b' 
  AND (
    token = 'ol+IJbfD5mNGSXE5whMJn1nQq2r5Y8q6JeIeEp8MlXw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029