UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5VcicLq4cyCEGQwZ9qrJXXkReMuuQkDOP5fSc6Tbkqo=' 
WHERE 
  key_id = '642e4794a370bb1600ec17f6d8ca9a5a2ade37c9b2e006206d8ebf5776f47cee' 
  AND (
    token = '5VcicLq4cyCEGQwZ9qrJXXkReMuuQkDOP5fSc6Tbkqo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030