UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KXPhMTZKKBGlytRc3mK0n0bTZAVXW95U9HYUcW/ltqw=' 
WHERE 
  key_id = '6261dd7fabcbd2bfee763cbebd1f42af11a9093e41168cdccb5b13b572d4fbd3' 
  AND (
    token = 'KXPhMTZKKBGlytRc3mK0n0bTZAVXW95U9HYUcW/ltqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037