UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jQszL3HTtJ0KmBTZi0yNGWeg5sEOd0zw6Bg+QIDD1Jw=' 
WHERE 
  key_id = '513ce33708fd8994d1b3320d02c87bf3eb9c00f5e1f34d859751d670dff35763' 
  AND (
    token = 'jQszL3HTtJ0KmBTZi0yNGWeg5sEOd0zw6Bg+QIDD1Jw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037