UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3fPj4X8Bp1hipanozYoLdaTUriltMzenL7L9rpfWrTk=' 
WHERE 
  key_id = '0383dd7c673539656226623a528187621062bcb658e10509e694e15a5538b41d' 
  AND (
    token = '3fPj4X8Bp1hipanozYoLdaTUriltMzenL7L9rpfWrTk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039