UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jRsZFUmInVTxgIaX+AmXQrM7kqQe/LmA+bwv58RUMDw=' 
WHERE 
  key_id = '3061b5318f74f45ac6d9e00805314616f79212e6d38587620cd361406a34987c' 
  AND (
    token = 'jRsZFUmInVTxgIaX+AmXQrM7kqQe/LmA+bwv58RUMDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028