UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HpzsmGLWQgptS+9IW1Re6FRZJUylvUroc8WYXc2LvDY=' 
WHERE 
  key_id = '37267cb9199256ebc42c328f3ec8deaee7bf14ac487da7546f0aed2186c73852' 
  AND (
    token = 'HpzsmGLWQgptS+9IW1Re6FRZJUylvUroc8WYXc2LvDY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044