UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OG08P4mpnD2fQU5omf3N6rqHBjW+fE8vUkmTQUbzaeA=' 
WHERE 
  key_id = '07b1f39563438bf5b11d1dc41371481b94ee4a73e52fa895902f5a54fb03f984' 
  AND (
    token = 'OG08P4mpnD2fQU5omf3N6rqHBjW+fE8vUkmTQUbzaeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039