UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NGfSiCunqEDBP/Rnqge09q1gnkIN9mK1fT7TFkADcr8=' 
WHERE 
  key_id = 'ce09a70e7a5ceb61edf8b1593a086dcc7763305b752f409363bcd2ef8f3fe82c' 
  AND (
    token = 'NGfSiCunqEDBP/Rnqge09q1gnkIN9mK1fT7TFkADcr8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028