UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K8VDvRfjwyS7oAYWvNlJsznkxb5j/9mtY2+xx7PAiv8=' 
WHERE 
  key_id = '187917445e010bb21dd0b177de77e79e02c2946730fb6d91241bb893fdfd2f5f' 
  AND (
    token = 'K8VDvRfjwyS7oAYWvNlJsznkxb5j/9mtY2+xx7PAiv8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035